Current Location: Home> Function Categories> date_timestamp_set

date_timestamp_set

Alias ​​for DateTime::setTimestamp - Set DateTime object in Unix timestamp
Name:date_timestamp_set
Category:Date and time
Programming Language:php
One-line Description:Sets the date and time based on Unix timestamps.

Definition and usage

date_timestamp_set() function sets the date and time based on the Unix timestamp.

Example

Set the date and time based on Unix timestamps:

 <?php
$date = date_create ( ) ;
date_timestamp_set ( $date , 1472988263 ) ;
echo date_format ( $date , "U = Ymd H:i:s" ) ;
?>

Try it yourself

grammar

 date_timestamp_set ( object , unixtimestamp ) ;
parameter describe
object Required. Specifies the DateTime object returned by date_create() . This function modifies the object.
unixtimestamp Required. A Unix timestamp that specifies a date.
Similar Functions
Popular Articles